close all
clear


%% Load data

file_name_1 = 'mat_files\m2023_01_07_1_effective_U_phase_0p5_delta_N_vs_modfreq3_evol_36p25ms.mat';
file_name_2 = 'mat_files\m2023_01_05_1_2D2_qw_n2_6Er_modfreq3_1010_phase1p0.mat';
file_name_3 = 'mat_files\m2023_01_30_1_effective_U_modfreq3_1070_CK_DC_delta_N_vs_modfreq3_evol_36p25ms';

ps_deltaN_U_0p5 = load(file_name_1);
ps_deltaN_U_0p5_modfreq3_1070 = load(file_name_3);
ps_qw_1p0 = load(file_name_2);

c1 = [0.2 0.7070 0.980];
c1_p = [0 0.3570 0.650];


%% Plot

evolution_dur = '36.25';
J_eff = 10.6; % from single particle quantum walk on 2023/01/04
U_data = (1010 - [ps_deltaN_U_0p5.uniquefvals; 1070])/J_eff;
t_data = (ps_qw_1p0.uniquetvals) * (2*pi*J_eff/1000);

fig1 = figure('Position', [400, 400, 250, 200]);
hold on
err1 = errorbar(U_data, [ps_deltaN_U_0p5.P_post_compressed; ps_deltaN_U_0p5_modfreq3_1070.P_post_compressed(2)], [ps_deltaN_U_0p5.P_post_err; ps_deltaN_U_0p5_modfreq3_1070.P_post_err(2)], 'o', 'Capsize', 0, 'LineWidth', 1, 'MarkerSize', 3, 'DisplayName', 'Total', 'Color', c1_p, 'MarkerFaceColor', c1, 'MarkerEdgeColor', c1_p);
xlabel('{\itU} ({\itJ})')
xticks(-6:2:6)
ylabel('Post-selection rate')
xlim([-6 6])
ylim([0 1])
ax = gca;
ax.FontName = 'Helvetica';
ax.FontSize = 8;
hold off
box on

fig2 = figure('Position', [400, 400, 250, 200]);
hold on
err2 = errorbar(t_data, ps_qw_1p0.P_post_compressed, ps_qw_1p0.P_post_err, 'o', 'Capsize', 0, 'LineWidth', 1, 'MarkerSize', 3, 'DisplayName', 'Total', 'Color', c1_p, 'MarkerFaceColor', c1, 'MarkerEdgeColor', c1_p); 
xlabel('{\itt} ({\it\tau})')
ylabel('Post-selection rate')
ylim([0 1])
ax = gca;
ax.FontName = 'Helvetica';
ax.FontSize = 8;
hold off
box on 



